package cn.mengfly.fxtest.app;


import javafx.application.Application;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;


/**
 * @author Mengfly
 * @date 2021/5/26 18:20
 */
public class TransformApp extends Application {



    private Parent createContent() {
        Rectangle box = new Rectangle(100, 50, Color.BLUE);

        transform(box);

        return new Pane(box);
    }

    private void transform(Rectangle box) {
        // we will apply transformations here
        box.setTranslateX(100);
        box.setTranslateY(100);

        box.setScaleX(1.5);
        box.setScaleY(1.5);

        box.setRotate(30);
    }


    @Override
    public void start(Stage primaryStage) {
        primaryStage.setScene(new Scene(createContent(), 300, 300, Color.GRAY));
        primaryStage.show();
    }
}
